import scrapy




class AmazonItem(scrapy.Item):
    # define the fields for your item here like:
    # name = scrapy.Field()
    url = scrapy.Field()
    title = scrapy.Field()  # //span[@id="productTitle"]/text()
    price = scrapy.Field()

    """ price字段可能的xpath
    # 单个价格: //div[@id="corePrice_feature_div"]//span[@class="a-offscreen"]/text()
    # 区间价格: //td[@class="a-span12"]//span[@class="a-offscreen"]
    # 双价格: //*[@id="corePriceDisplay_desktop_feature_div"]/div[1]/span[3]/span[2]
    """
    price_xpath_list = [
        '//div[@id="corePrice_feature_div"]//span[@class="a-offscreen"]/text()',
        '//td[@class="a-span12"]//span[@class="a-offscreen"]/text()',
        '//*[@id="corePriceDisplay_desktop_feature_div"]/div[1]/span[3]/span[2]',
    ]
